﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Interface;
using System.ServiceModel;
using Domain;

namespace ConsoleClient.Services
{
    public class SchoolService : ClientBase<ISchoolService>, ISchoolService
    {

        public SchoolService()
            : base("SchoolEndpoint")
        {

        }

        #region ISchoolService Members

        public Person GetPerson(int id, bool fetchEnrollments, bool fetchCourses)
        {
            using (OperationContextScope context = new OperationContextScope(this.InnerChannel))
            {
                return base.Channel.GetPerson(id, fetchEnrollments, fetchCourses);
            }
        }


        public void SavePerson(Person person)
        {
            using (OperationContextScope context = new OperationContextScope(this.InnerChannel))
            {
                base.Channel.SavePerson(person);
            }
        }

        public IList<Course> GetCourses()
        {
            using (OperationContextScope context = new OperationContextScope(this.InnerChannel))
            {
                return base.Channel.GetCourses();
            }
        }

        public IList<Department> GetDepartments()
        {
            using (OperationContextScope context = new OperationContextScope(this.InnerChannel))
            {
                return base.Channel.GetDepartments();
            }
        }

        #endregion
    }
}
